package org.zlb.manager.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.zlb.manager.dao.OrgDeptDao;
import org.zlb.manager.entity.OrgDept;

import java.util.List;

/**
 * TODO
 *
 * @author zhoulingbo
 * @date 2021/8/17 17:55
 */
@Component
public class OrgDeptService {

    @Autowired
    private OrgDeptDao deptDao;

    public List<OrgDept> list() {
        return deptDao.findAll();
    }

    public OrgDept item(String deptCode) {
        return deptDao.getById(deptCode);
    }

    public OrgDept save(OrgDept dept) {
        return deptDao.save(dept);
    }

    public void delete(String deptCode) {
        deptDao.deleteById(deptCode);
    }

    public long count() {
        return deptDao.count();
    }
}
